// BCMiniMentalPage.cpp : implementation file
//

#include "stdafx.h"
#include "BCMiniMentalPage.h"
#include "../Frame/GYWalkAidApp.h"
#include "../Common/CommonFun.h"
#include "../Common/LinkComboBox.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

static INPUT_FIELD_INFO s_InputFieldArray1[] = 
{
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("10"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("20"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("30"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("40"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("50"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("60"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("70"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("80"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("90"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("100"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("110"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("120"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("130"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("140"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("150"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("160"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("170"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("180"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("190"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("200"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("210"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("220"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("230"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("240"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("250"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("260"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("270"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("280"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("290"),		ftString,	FALSE,	0,	2,		NULL,		NULL	},
};

static INPUT_FIELD_INFO s_InputFieldArray2[] = 
{
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("10"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("20"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("30"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("40"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("50"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("60"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("70"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("80"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("90"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("100"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("110"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("120"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("130"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("140"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("150"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("160"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("170"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("180"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("190"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("200"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("210"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("220"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("230"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("240"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("250"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("260"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("270"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("280"),		ftString,	FALSE,	0,	1,		NULL,		NULL	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("290"),		ftString,	FALSE,	0,	2,		NULL,		NULL	},
};

static INPUT_FIELD_INFO s_InputFieldArray3[] = 
{
	{NULL,		IBT_NoneType,	FALSE,	TRUE,	_T("10"),		ftString,	FALSE,	0,	1,		CBCMiniMentalPage::ScoreFieldsCheck,	CBCMiniMentalPage::ScoreFieldsCheck	},
	{NULL,		IBT_NoneType,	FALSE,	TRUE,	_T("20"),		ftString,	FALSE,	0,	1,		CBCMiniMentalPage::ScoreFieldsCheck,	CBCMiniMentalPage::ScoreFieldsCheck	},
	{NULL,		IBT_NoneType,	FALSE,	TRUE,	_T("30"),		ftString,	FALSE,	0,	1,		CBCMiniMentalPage::ScoreFieldsCheck,	CBCMiniMentalPage::ScoreFieldsCheck	},
	{NULL,		IBT_NoneType,	FALSE,	TRUE,	_T("40"),		ftString,	FALSE,	0,	1,		CBCMiniMentalPage::ScoreFieldsCheck,	CBCMiniMentalPage::ScoreFieldsCheck	},
	{NULL,		IBT_NoneType,	FALSE,	TRUE,	_T("50"),		ftString,	FALSE,	0,	1,		CBCMiniMentalPage::ScoreFieldsCheck,	CBCMiniMentalPage::ScoreFieldsCheck	},
	{NULL,		IBT_NoneType,	FALSE,	TRUE,	_T("60"),		ftString,	FALSE,	0,	1,		CBCMiniMentalPage::ScoreFieldsCheck,	CBCMiniMentalPage::ScoreFieldsCheck	},
	{NULL,		IBT_NoneType,	FALSE,	TRUE,	_T("70"),		ftString,	FALSE,	0,	1,		CBCMiniMentalPage::ScoreFieldsCheck,	CBCMiniMentalPage::ScoreFieldsCheck	},
	{NULL,		IBT_NoneType,	FALSE,	TRUE,	_T("80"),		ftString,	FALSE,	0,	1,		CBCMiniMentalPage::ScoreFieldsCheck,	CBCMiniMentalPage::ScoreFieldsCheck	},
	{NULL,		IBT_NoneType,	FALSE,	TRUE,	_T("90"),		ftString,	FALSE,	0,	1,		CBCMiniMentalPage::ScoreFieldsCheck,	CBCMiniMentalPage::ScoreFieldsCheck	},
	{NULL,		IBT_NoneType,	FALSE,	TRUE,	_T("100"),		ftString,	FALSE,	0,	1,		CBCMiniMentalPage::ScoreFieldsCheck,	CBCMiniMentalPage::ScoreFieldsCheck	},
	{NULL,		IBT_NoneType,	FALSE,	TRUE,	_T("110"),		ftString,	FALSE,	0,	1,		CBCMiniMentalPage::ScoreFieldsCheck,	CBCMiniMentalPage::ScoreFieldsCheck	},
	{NULL,		IBT_NoneType,	FALSE,	TRUE,	_T("120"),		ftString,	FALSE,	0,	1,		CBCMiniMentalPage::ScoreFieldsCheck,	CBCMiniMentalPage::ScoreFieldsCheck	},
	{NULL,		IBT_NoneType,	FALSE,	TRUE,	_T("130"),		ftString,	FALSE,	0,	1,		CBCMiniMentalPage::ScoreFieldsCheck,	CBCMiniMentalPage::ScoreFieldsCheck	},
	{NULL,		IBT_NoneType,	FALSE,	TRUE,	_T("140"),		ftString,	FALSE,	0,	1,		CBCMiniMentalPage::ScoreFieldsCheck,	CBCMiniMentalPage::ScoreFieldsCheck	},
	{NULL,		IBT_NoneType,	FALSE,	TRUE,	_T("150"),		ftString,	FALSE,	0,	1,		CBCMiniMentalPage::ScoreFieldsCheck,	CBCMiniMentalPage::ScoreFieldsCheck	},
	{NULL,		IBT_NoneType,	FALSE,	TRUE,	_T("160"),		ftString,	FALSE,	0,	1,		CBCMiniMentalPage::ScoreFieldsCheck,	CBCMiniMentalPage::ScoreFieldsCheck	},
	{NULL,		IBT_NoneType,	FALSE,	TRUE,	_T("170"),		ftString,	FALSE,	0,	1,		CBCMiniMentalPage::ScoreFieldsCheck,	CBCMiniMentalPage::ScoreFieldsCheck	},
	{NULL,		IBT_NoneType,	FALSE,	TRUE,	_T("180"),		ftString,	FALSE,	0,	1,		CBCMiniMentalPage::ScoreFieldsCheck,	CBCMiniMentalPage::ScoreFieldsCheck	},
	{NULL,		IBT_NoneType,	FALSE,	TRUE,	_T("190"),		ftString,	FALSE,	0,	1,		CBCMiniMentalPage::ScoreFieldsCheck,	CBCMiniMentalPage::ScoreFieldsCheck	},
	{NULL,		IBT_NoneType,	FALSE,	TRUE,	_T("200"),		ftString,	FALSE,	0,	1,		CBCMiniMentalPage::ScoreFieldsCheck,	CBCMiniMentalPage::ScoreFieldsCheck	},
	{NULL,		IBT_NoneType,	FALSE,	TRUE,	_T("210"),		ftString,	FALSE,	0,	1,		CBCMiniMentalPage::ScoreFieldsCheck,	CBCMiniMentalPage::ScoreFieldsCheck	},
	{NULL,		IBT_NoneType,	FALSE,	TRUE,	_T("220"),		ftString,	FALSE,	0,	1,		CBCMiniMentalPage::ScoreFieldsCheck,	CBCMiniMentalPage::ScoreFieldsCheck	},
	{NULL,		IBT_NoneType,	FALSE,	TRUE,	_T("230"),		ftString,	FALSE,	0,	1,		CBCMiniMentalPage::ScoreFieldsCheck,	CBCMiniMentalPage::ScoreFieldsCheck	},
	{NULL,		IBT_NoneType,	FALSE,	TRUE,	_T("240"),		ftString,	FALSE,	0,	1,		CBCMiniMentalPage::ScoreFieldsCheck,	CBCMiniMentalPage::ScoreFieldsCheck	},
	{NULL,		IBT_NoneType,	FALSE,	TRUE,	_T("250"),		ftString,	FALSE,	0,	1,		CBCMiniMentalPage::ScoreFieldsCheck,	CBCMiniMentalPage::ScoreFieldsCheck	},
	{NULL,		IBT_NoneType,	FALSE,	TRUE,	_T("260"),		ftString,	FALSE,	0,	1,		CBCMiniMentalPage::ScoreFieldsCheck,	CBCMiniMentalPage::ScoreFieldsCheck	},
	{NULL,		IBT_NoneType,	FALSE,	TRUE,	_T("270"),		ftString,	FALSE,	0,	1,		CBCMiniMentalPage::ScoreFieldsCheck,	CBCMiniMentalPage::ScoreFieldsCheck	},
	{NULL,		IBT_NoneType,	FALSE,	TRUE,	_T("280"),		ftString,	FALSE,	0,	1,		CBCMiniMentalPage::ScoreFieldsCheck,	CBCMiniMentalPage::ScoreFieldsCheck	},
	{NULL,		IBT_NoneType,	TRUE,	TRUE,	_T("290"),		ftString,	FALSE,	0,	2,		NULL,									NULL	},
};


/////////////////////////////////////////////////////////////////////////////
// CBCMiniMentalPage dialog


CBCMiniMentalPage::CBCMiniMentalPage(CWnd* pParent, BOOL bBigRes) : CScrollPage(bBigRes ? CBCMiniMentalPage::IDD : CBCMiniMentalPage::SD_IDD, pParent)
, m_edtMini101(&m_InputFieldArray1[0]),		m_edtMini201(&m_InputFieldArray2[0]),	m_cmbMini301(&m_InputFieldArray3[0])
, m_edtMini102(&m_InputFieldArray1[1]),		m_edtMini202(&m_InputFieldArray2[1]),	m_cmbMini302(&m_InputFieldArray3[1])
, m_edtMini103(&m_InputFieldArray1[2]),		m_edtMini203(&m_InputFieldArray2[2]),	m_cmbMini303(&m_InputFieldArray3[2])
, m_edtMini104(&m_InputFieldArray1[3]),		m_edtMini204(&m_InputFieldArray2[3]),	m_cmbMini304(&m_InputFieldArray3[3])
, m_edtMini105(&m_InputFieldArray1[4]),		m_edtMini205(&m_InputFieldArray2[4]),	m_cmbMini305(&m_InputFieldArray3[4])
, m_edtMini106(&m_InputFieldArray1[5]),		m_edtMini206(&m_InputFieldArray2[5]),	m_cmbMini306(&m_InputFieldArray3[5])
, m_edtMini107(&m_InputFieldArray1[6]),		m_edtMini207(&m_InputFieldArray2[6]),	m_cmbMini307(&m_InputFieldArray3[6])
, m_edtMini108(&m_InputFieldArray1[7]),		m_edtMini208(&m_InputFieldArray2[7]),	m_cmbMini308(&m_InputFieldArray3[7])
, m_edtMini109(&m_InputFieldArray1[8]),		m_edtMini209(&m_InputFieldArray2[8]),	m_cmbMini309(&m_InputFieldArray3[8])
, m_edtMini110(&m_InputFieldArray1[9]),		m_edtMini210(&m_InputFieldArray2[9]),	m_cmbMini310(&m_InputFieldArray3[9])
, m_edtMini111(&m_InputFieldArray1[10]),	m_edtMini211(&m_InputFieldArray2[10]),	m_cmbMini311(&m_InputFieldArray3[10])
, m_edtMini112(&m_InputFieldArray1[11]),	m_edtMini212(&m_InputFieldArray2[11]),	m_cmbMini312(&m_InputFieldArray3[11])
, m_edtMini113(&m_InputFieldArray1[12]),	m_edtMini213(&m_InputFieldArray2[12]),	m_cmbMini313(&m_InputFieldArray3[12])
, m_edtMini114(&m_InputFieldArray1[13]),	m_edtMini214(&m_InputFieldArray2[13]),	m_cmbMini314(&m_InputFieldArray3[13])
, m_edtMini115(&m_InputFieldArray1[14]),	m_edtMini215(&m_InputFieldArray2[14]),	m_cmbMini315(&m_InputFieldArray3[14])
, m_edtMini116(&m_InputFieldArray1[15]),	m_edtMini216(&m_InputFieldArray2[15]),	m_cmbMini316(&m_InputFieldArray3[15])
, m_edtMini117(&m_InputFieldArray1[16]),	m_edtMini217(&m_InputFieldArray2[16]),	m_cmbMini317(&m_InputFieldArray3[16])
, m_edtMini118(&m_InputFieldArray1[17]),	m_edtMini218(&m_InputFieldArray2[17]),	m_cmbMini318(&m_InputFieldArray3[17])
, m_edtMini119(&m_InputFieldArray1[18]),	m_edtMini219(&m_InputFieldArray2[18]),	m_cmbMini319(&m_InputFieldArray3[18])
, m_edtMini120(&m_InputFieldArray1[19]),	m_edtMini220(&m_InputFieldArray2[19]),	m_cmbMini320(&m_InputFieldArray3[19])
, m_edtMini121(&m_InputFieldArray1[20]),	m_edtMini221(&m_InputFieldArray2[20]),	m_cmbMini321(&m_InputFieldArray3[20])
, m_edtMini122(&m_InputFieldArray1[21]),	m_edtMini222(&m_InputFieldArray2[21]),	m_cmbMini322(&m_InputFieldArray3[21])
, m_edtMini123(&m_InputFieldArray1[22]),	m_edtMini223(&m_InputFieldArray2[22]),	m_cmbMini323(&m_InputFieldArray3[22])
, m_edtMini124(&m_InputFieldArray1[23]),	m_edtMini224(&m_InputFieldArray2[23]),	m_cmbMini324(&m_InputFieldArray3[23])
, m_edtMini125(&m_InputFieldArray1[24]),	m_edtMini225(&m_InputFieldArray2[24]),	m_cmbMini325(&m_InputFieldArray3[24])
, m_edtMini126(&m_InputFieldArray1[25]),	m_edtMini226(&m_InputFieldArray2[25]),	m_cmbMini326(&m_InputFieldArray3[25])
, m_edtMini127(&m_InputFieldArray1[26]),	m_edtMini227(&m_InputFieldArray2[26]),	m_cmbMini327(&m_InputFieldArray3[26])
, m_edtMini128(&m_InputFieldArray1[27]),	m_edtMini228(&m_InputFieldArray2[27]),	m_cmbMini328(&m_InputFieldArray3[27])
, m_edtMini129(&m_InputFieldArray1[28]),	m_edtMini229(&m_InputFieldArray2[28]),	m_edtMini329(&m_InputFieldArray3[28])
{
	//{{AFX_DATA_INIT(CBCMiniMentalPage)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT

	LPVOID pCtrl = NULL;
	DWORD dwControlType = IBT_NoneType;
	for(int i = 0; i < INPUT_EDIT_CTRL_COUNT; i++)
	{
		pCtrl = m_InputFieldArray1[i].pLinkCtrl;
		dwControlType = m_InputFieldArray1[i].dwCtrlType;
		memcpy(&m_InputFieldArray1[i], &s_InputFieldArray1[i], sizeof(INPUT_FIELD_INFO));
		m_InputFieldArray1[i].pLinkCtrl = pCtrl;
		m_InputFieldArray1[i].dwCtrlType = dwControlType;
		
		pCtrl = m_InputFieldArray2[i].pLinkCtrl;
		dwControlType = m_InputFieldArray2[i].dwCtrlType;
		memcpy(&m_InputFieldArray2[i], &s_InputFieldArray2[i], sizeof(INPUT_FIELD_INFO));
		m_InputFieldArray2[i].pLinkCtrl = pCtrl;
		m_InputFieldArray2[i].dwCtrlType = dwControlType;
		
		pCtrl = m_InputFieldArray3[i].pLinkCtrl;
		dwControlType = m_InputFieldArray3[i].dwCtrlType;
		memcpy(&m_InputFieldArray3[i], &s_InputFieldArray3[i], sizeof(INPUT_FIELD_INFO));
		m_InputFieldArray3[i].pLinkCtrl = pCtrl;
		m_InputFieldArray3[i].dwCtrlType = dwControlType;
	}
}

void CBCMiniMentalPage::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CBCMiniMentalPage)
	DDX_Control(pDX,IDC_EDIT_SCORE1, m_edtMini101);
	DDX_Control(pDX,IDC_EDIT_SCORE11, m_edtMini102);
	DDX_Control(pDX,IDC_EDIT_SCORE14, m_edtMini103);
	DDX_Control(pDX,IDC_EDIT_SCORE17, m_edtMini104);
	DDX_Control(pDX,IDC_EDIT_SCORE49, m_edtMini105);
	DDX_Control(pDX,IDC_EDIT_SCORE187, m_edtMini106);
	DDX_Control(pDX,IDC_EDIT_SCORE190, m_edtMini107);
	DDX_Control(pDX,IDC_EDIT_SCORE193, m_edtMini108);
	DDX_Control(pDX,IDC_EDIT_SCORE196, m_edtMini109);
	DDX_Control(pDX,IDC_EDIT_SCORE199, m_edtMini110);
	DDX_Control(pDX,IDC_EDIT_SCORE202, m_edtMini111);
	DDX_Control(pDX,IDC_EDIT_SCORE244, m_edtMini112);
	DDX_Control(pDX,IDC_EDIT_SCORE247, m_edtMini113);
	DDX_Control(pDX,IDC_EDIT_SCORE250, m_edtMini114);
	DDX_Control(pDX,IDC_EDIT_SCORE253, m_edtMini115);
	DDX_Control(pDX,IDC_EDIT_SCORE205, m_edtMini116);
	DDX_Control(pDX,IDC_EDIT_SCORE208, m_edtMini117);
	DDX_Control(pDX,IDC_EDIT_SCORE211, m_edtMini118);
	DDX_Control(pDX,IDC_EDIT_SCORE214, m_edtMini119);
	DDX_Control(pDX,IDC_EDIT_SCORE217, m_edtMini120);
	DDX_Control(pDX,IDC_EDIT_SCORE220, m_edtMini121);
	DDX_Control(pDX,IDC_EDIT_SCORE223, m_edtMini122);
	DDX_Control(pDX,IDC_EDIT_SCORE226, m_edtMini123);
	DDX_Control(pDX,IDC_EDIT_SCORE229, m_edtMini124);
	DDX_Control(pDX,IDC_EDIT_SCORE232, m_edtMini125);
	DDX_Control(pDX,IDC_EDIT_SCORE235, m_edtMini126);
	DDX_Control(pDX,IDC_EDIT_SCORE238, m_edtMini127);
	DDX_Control(pDX,IDC_EDIT_SCORE241, m_edtMini128);
	DDX_Control(pDX,IDC_EDIT_SCORE40, m_edtMini129);
	
	DDX_Control(pDX, IDC_EDIT_SCORE2, m_edtMini201);
	DDX_Control(pDX, IDC_EDIT_SCORE12, m_edtMini202);
	DDX_Control(pDX, IDC_EDIT_SCORE15, m_edtMini203);
	DDX_Control(pDX, IDC_EDIT_SCORE18, m_edtMini204);
	DDX_Control(pDX, IDC_EDIT_SCORE50, m_edtMini205);
	DDX_Control(pDX, IDC_EDIT_SCORE188, m_edtMini206);
	DDX_Control(pDX, IDC_EDIT_SCORE191, m_edtMini207);
	DDX_Control(pDX, IDC_EDIT_SCORE194, m_edtMini208);
	DDX_Control(pDX, IDC_EDIT_SCORE197, m_edtMini209);
	DDX_Control(pDX, IDC_EDIT_SCORE200, m_edtMini210);
	DDX_Control(pDX, IDC_EDIT_SCORE203, m_edtMini211);
	DDX_Control(pDX, IDC_EDIT_SCORE245, m_edtMini212);
	DDX_Control(pDX, IDC_EDIT_SCORE248, m_edtMini213);
	DDX_Control(pDX, IDC_EDIT_SCORE251, m_edtMini214);
	DDX_Control(pDX, IDC_EDIT_SCORE254, m_edtMini215);
	DDX_Control(pDX, IDC_EDIT_SCORE206, m_edtMini216);
	DDX_Control(pDX, IDC_EDIT_SCORE209, m_edtMini217);
	DDX_Control(pDX, IDC_EDIT_SCORE212, m_edtMini218);
	DDX_Control(pDX, IDC_EDIT_SCORE215, m_edtMini219);
	DDX_Control(pDX, IDC_EDIT_SCORE218, m_edtMini220);
	DDX_Control(pDX, IDC_EDIT_SCORE221, m_edtMini221);
	DDX_Control(pDX, IDC_EDIT_SCORE224, m_edtMini222);
	DDX_Control(pDX, IDC_EDIT_SCORE227, m_edtMini223);
	DDX_Control(pDX, IDC_EDIT_SCORE230, m_edtMini224);
	DDX_Control(pDX, IDC_EDIT_SCORE233, m_edtMini225);
	DDX_Control(pDX, IDC_EDIT_SCORE236, m_edtMini226);
	DDX_Control(pDX, IDC_EDIT_SCORE239, m_edtMini227);
	DDX_Control(pDX, IDC_EDIT_SCORE242, m_edtMini228);
	DDX_Control(pDX, IDC_EDIT_SCORE41, m_edtMini229);
	
	DDX_Control(pDX, IDC_EDIT_SCORE3, m_cmbMini301);
	DDX_Control(pDX, IDC_EDIT_SCORE10, m_cmbMini302);
	DDX_Control(pDX, IDC_EDIT_SCORE13, m_cmbMini303);
	DDX_Control(pDX, IDC_EDIT_SCORE16, m_cmbMini304);
	DDX_Control(pDX, IDC_EDIT_SCORE48, m_cmbMini305);
	DDX_Control(pDX, IDC_EDIT_SCORE51, m_cmbMini306);
	DDX_Control(pDX, IDC_EDIT_SCORE189, m_cmbMini307);
	DDX_Control(pDX, IDC_EDIT_SCORE192, m_cmbMini308);
	DDX_Control(pDX, IDC_EDIT_SCORE195, m_cmbMini309);
	DDX_Control(pDX, IDC_EDIT_SCORE198, m_cmbMini310);
	DDX_Control(pDX, IDC_EDIT_SCORE201, m_cmbMini311);
	DDX_Control(pDX, IDC_EDIT_SCORE243, m_cmbMini312);
	DDX_Control(pDX, IDC_EDIT_SCORE246, m_cmbMini313);
	DDX_Control(pDX, IDC_EDIT_SCORE249, m_cmbMini314);
	DDX_Control(pDX, IDC_EDIT_SCORE252, m_cmbMini315);
	DDX_Control(pDX, IDC_EDIT_SCORE204, m_cmbMini316);
	DDX_Control(pDX, IDC_EDIT_SCORE207, m_cmbMini317);
	DDX_Control(pDX, IDC_EDIT_SCORE210, m_cmbMini318);
	DDX_Control(pDX, IDC_EDIT_SCORE213, m_cmbMini319);
	DDX_Control(pDX, IDC_EDIT_SCORE216, m_cmbMini320);
	DDX_Control(pDX, IDC_EDIT_SCORE219, m_cmbMini321);
	DDX_Control(pDX, IDC_EDIT_SCORE222, m_cmbMini322);
	DDX_Control(pDX, IDC_EDIT_SCORE225, m_cmbMini323);
	DDX_Control(pDX, IDC_EDIT_SCORE228, m_cmbMini324);
	DDX_Control(pDX, IDC_EDIT_SCORE231, m_cmbMini325);
	DDX_Control(pDX, IDC_EDIT_SCORE234, m_cmbMini326);
	DDX_Control(pDX, IDC_EDIT_SCORE237, m_cmbMini327);
	DDX_Control(pDX, IDC_EDIT_SCORE240, m_cmbMini328);
	DDX_Control(pDX, IDC_EDIT_SCORE108, m_edtMini329);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CBCMiniMentalPage, CDialog)
	//{{AFX_MSG_MAP(CBCMiniMentalPage)
	ON_WM_VSCROLL()
	ON_WM_SIZE()
	ON_WM_MOUSEWHEEL()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CBCMiniMentalPage message handlers

void CBCMiniMentalPage::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) 
{
	//...

	CScrollPage::OnVScroll(nSBCode, nPos, pScrollBar);
}

void CBCMiniMentalPage::OnSize(UINT nType, int cx, int cy) 
{
	CScrollPage::OnSize(nType, cx, cy);
	
	//...
}

BOOL CBCMiniMentalPage::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) 
{
	//...

	return CScrollPage::OnMouseWheel(nFlags, zDelta, pt);
}

BOOL CBCMiniMentalPage::ClearData()
{
	INPUT_FIELD_INFO* ppCtrlArray[3];
	ppCtrlArray[0] = m_InputFieldArray1;
	ppCtrlArray[1] = m_InputFieldArray2;
	ppCtrlArray[2] = m_InputFieldArray3;
	
	CWnd* apDateLabel[3];
	apDateLabel[0] = GetDlgItem(IDC_STATIC_DATE_1);
	apDateLabel[1] = GetDlgItem(IDC_STATIC_DATE_2);
	apDateLabel[2] = GetDlgItem(IDC_STATIC_DATE_3);

	CWnd* apDiagSNArray[3];
	apDiagSNArray[0] = GetDlgItem(IDC_STATIC_DIAGSN1);
	apDiagSNArray[1] = GetDlgItem(IDC_STATIC_DIAGSN2);
	apDiagSNArray[2] = GetDlgItem(IDC_STATIC_DIAGSN3);
	
	return PageClearData(ppCtrlArray, INPUT_EDIT_CTRL_COUNT, apDateLabel, apDiagSNArray, ARRAY_ELE_COUNT(apDateLabel));
}

int CBCMiniMentalPage::SaveData(CString strMRN, int nDiagSN, BOOL bIsDraft)
{
	INPUT_FIELD_INFO* ppCtrlArray[3];
	ppCtrlArray[0] = m_InputFieldArray1;
	ppCtrlArray[1] = m_InputFieldArray2;
	ppCtrlArray[2] = m_InputFieldArray3;
	
	return PageSaveData(strMRN, nDiagSN, bIsDraft, BODYCHECKSCALEID, ppCtrlArray, INPUT_EDIT_CTRL_COUNT);
}

BOOL CBCMiniMentalPage::ScoreFieldsCheck(LPVOID pParam)
{
	CBCMiniMentalPage* pParent = NULL;
	INPUT_FIELD_INFO* pFieldInfo = (INPUT_FIELD_INFO*)pParam;

	if(pFieldInfo->dwCtrlType == IBT_EditBox)
	{
		CLinkEdit* pEdit = (CLinkEdit*)pFieldInfo->pLinkCtrl;
		if(pEdit)
			pParent = (CBCMiniMentalPage*)pEdit->GetParent();
	}
	else if(pFieldInfo->dwCtrlType == IBT_ComboBox)
	{
		CLinkComboBox* pCombo = (CLinkComboBox*)pFieldInfo->pLinkCtrl;
		if(pCombo)
			pParent = (CBCMiniMentalPage*)pCombo->GetParent();
	}
	else
	{
		ASSERT(FALSE);
	}

	if(pParent == NULL)
	{
		ASSERT(FALSE);
		return FALSE;
	}

	return PageScoreFieldsCheck(pParam, 0, 4, pParent->m_InputFieldArray3, INPUT_EDIT_CTRL_COUNT);
}

BOOL CBCMiniMentalPage::ShowTableDataWithStartCol(CString strMRN, int nDiagSN, int nStartCol)
{
	INPUT_FIELD_INFO* ppCtrlArray[3];
	ppCtrlArray[0] = m_InputFieldArray1;
	ppCtrlArray[1] = m_InputFieldArray2;
	ppCtrlArray[2] = m_InputFieldArray3;
	
	CWnd* apDateLabel[3];
	apDateLabel[0] = GetDlgItem(IDC_STATIC_DATE_1);
	apDateLabel[1] = GetDlgItem(IDC_STATIC_DATE_2);
	apDateLabel[2] = GetDlgItem(IDC_STATIC_DATE_3);
	
	CWnd* apDiagSNArray[3];
	apDiagSNArray[0] = GetDlgItem(IDC_STATIC_DIAGSN1);
	apDiagSNArray[1] = GetDlgItem(IDC_STATIC_DIAGSN2);
	apDiagSNArray[2] = GetDlgItem(IDC_STATIC_DIAGSN3);
	
	return PageShowTableData(strMRN, nDiagSN, BODYCHECKSCALEID, ppCtrlArray, INPUT_EDIT_CTRL_COUNT, apDateLabel, apDiagSNArray, nStartCol);
}

BOOL CBCMiniMentalPage::ShowTableData(CString strMRN, int nDiagSN)
{
	return ShowTableDataWithStartCol(strMRN, nDiagSN, 2);
}

BOOL CBCMiniMentalPage::EnableInputControls(BOOL bEnable)
{
	INPUT_FIELD_INFO* ppCtrlArray[3];
	ppCtrlArray[0] = m_InputFieldArray1;
	ppCtrlArray[1] = m_InputFieldArray2;
	ppCtrlArray[2] = m_InputFieldArray3;

	return PageEnableInputControls(bEnable, ppCtrlArray, INPUT_EDIT_CTRL_COUNT);
}

BOOL CBCMiniMentalPage::IsPageCurDayBlank()
{
	return CScrollPage::PageIsAllInputBlank(m_InputFieldArray3, INPUT_EDIT_CTRL_COUNT);
}

BOOL CBCMiniMentalPage::SetLastColTitile(CString strDate, int nDiagSN)
{
	CWnd* apDateLabel[3] = {0};
	apDateLabel[2] = GetDlgItem(IDC_STATIC_DATE_3);

	CString astrDate[3];
	astrDate[2] = strDate;
	
	CWnd* apDiagSNArray[3] = {0};
	apDiagSNArray[2] = GetDlgItem(IDC_STATIC_DIAGSN3);

	int anDiagSN[3] = {0};
	anDiagSN[2] = nDiagSN;

	return PageShowColTitle(apDateLabel, astrDate, apDiagSNArray, anDiagSN, ARRAY_ELE_COUNT(apDateLabel));
}
